package com.jetpackframework.webview;

import android.graphics.Bitmap;
import android.util.Log;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;

import androidx.annotation.Nullable;

public class WebViewClient extends android.webkit.WebViewClient{
    private WebViewCallBack callback;

    public WebViewClient(WebViewCallBack callBack){
        this.callback = callBack;
    }

    @Nullable
    @Override
    public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
        Log.e("TAG","shouldInterceptRequest");
        return super.shouldInterceptRequest(view, request);
    }

    @Override
    public void onPageStarted(WebView view, String url, Bitmap favicon) {
        if (callback != null){
            callback.onPageStarted(view,url);
        }
    }

    @Override
    public void onPageFinished(WebView view, String url) {
        if (callback != null){
            callback.onPageFinished(view,url);
        }

    }
}
